package ru.nnstu.checkerlogview;

import java.awt.*;
import java.awt.event.*;

import javax.swing.JButton;

public class Launcher {
	public static void main(String[] args) throws Throwable {
		Frame f = new Frame("Checkers");
		f.setLayout(new GridBagLayout());
		f.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
		final Board b = new Board();
		JButton exitBtn = new JButton();
		final JButton nextBtn = new JButton();
		exitBtn.setText("exit");		
		exitBtn.setSize(100, 35);		
		exitBtn.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        		System.exit(0);
        	}
        });
		nextBtn.setText("next");
		nextBtn.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        		if(!b.go()) {
        			nextBtn.setEnabled(false);
        		}
        	}
        });
		exitBtn.setSize(100, 35);
		f.add(b);
		f.add(exitBtn);
		f.add(nextBtn);
		f.pack();
		f.show();
	}
}
